<template>
	<view>
		<view class="items">
			<view class="item" v-for="(u, index) in users" @click="chot(index)">
				<image class="header" :src="u.header" mode="aspectFill"></image>
				<view class="name">{{u.nick_name}}</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				users: [],
				type: 0
			}
		},
		onLoad() {
			this.type = this.$route.query.type
			console.log('type:', this.type)
			window.electronAPI.getBindToList(this.type).then((users) => {
				this.users = users
			})
		},
		methods: {
			chot(index) {
				window.electronAPI.changeBindTo(this.users[index].id, this.type)
			}
		}
	}
</script>

<style scoped>
	.items {
		display: flex;
		flex-direction: column;
	}
	
	.item {
		display: flex;
		align-items: center;
		background-color: #272730;
	}
	
	.item:hover {
		cursor: pointer;
		background-color: #373744;
	}
	
	.item:active {
		background-color: #2f2f3a;
	}
	
	.header {
		border: white 1px solid;
		box-sizing: border-box;
		width: 30px;
		height: 30px;
		border-radius: 100%;
		margin: 10px;
	}
	
	.name {
		color: wheat;
	}
	
</style>
